<template>
	<view>
<!-- 		<view class="biaoxx">
			<input class="shuruk"  type="text" placeholder="输入关键字查找" @input="shousuo"/>
			<view class="chakgd" @click="gohetong">添加合同</view>
		</view> -->
		<view class="htlist">
			<view class="hetxm" v-for="item in 1" @click="gohtxiangq(item.id)">
				<view class="hetsbf">
					<view class="htbiaoti">劳动合同</view>
					<view>正常</view>
				</view>
				<view class="hetxbf">
					<view class="hetjine">期限:2021年12月21日/2022年12月21日</view>
					<!-- <view :class="item.htleix==0?'zifu':'shok'">{{item.htleix==0?'支付':'收款'}}</view> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				user:null,
				ssk:'',
				yema:1,
				htlist:[]
			}
		},
		onLoad:function(){
			// var that = this
			// uni.getStorage({
			// 	key: 'user',
			// 	success: function (res) {
			// 		that.user = res.data;
			// 		that.gethtlist(1,res.data.gsid);
			// 	}
			// })
		},
		onShow:function(){
			// var that = this
			// uni.$on('updateData',function(data){
			// 	if(data==1){
			// 		that.yema = 1;
			// 		that.htlist = [];
			// 		that.gethtlist(1,that.user.gsid);
			// 	}else{
			// 		return
			// 	}
			// })
		},
		onReachBottom:function(){
			// this.yema=this.yema+1;
			// this.gethtlist(this.yema,this.user.gsid);
		},
		methods: {
			// 关键字查询
			shousuo(e){
				var that=this;
				that.ssk = e.detail.value;
				uni.request({
					url: getApp().globalData.url+'/api/GetHtmh',
					data:{
						guanjz:e.detail.value
					},
					header: {
					   "Content-Type": "text/html"
					}, 
					success(res) {
						if(res.data.code==200){
							that.htlist=res.data.data
						}else{
							wx.showToast({
								title: '无查询结果',
								icon: 'none', 
								duration: 2000     
							})  
						}
					}
				})
			},
			// 获取合同列表
			gethtlist(yem,gid){
				var that=this;
				uni.request({
					url: getApp().globalData.url+'/api/GetHtlist',
					data:{
						yema:yem,
						gsid:gid
					},
					header: {
					   "Content-Type": "text/html"
					}, 
					success(res) {
						if(res.data.code==200){
							console.log('合同列表',res.data.data)
							if(yem==1){
								that.htlist=res.data.data
							}else{
								that.htlist=that.htlist.concat(res.data.data);
							}
						}else{
							wx.showToast({
								title: '没有数据',
								icon: 'none', 
								duration: 2000     
							})  
						}
					}
				})
			},
			// 合同详情
			gohtxiangq(e){
				uni.navigateTo({
					url:'../htxiangq/htxiangq?id='+e
				})
			},
			// 添加合同
			gohetong(){
				uni.navigateTo({
					url:'../addhetong/addhetong'
				})
			}
		}
	}
</script>

<style>
	page{
		background: #f0f0f0;
	}
</style>
<style lang="scss" scoped>
	.biaoxx{
		position: fixed;
		top: 0;
		z-index: 999;
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 710rpx;
		padding: 20rpx;
		background: #ffffff;
		.shuruk{
			background: #f0f0f0;
			padding: 20rpx 30rpx;
			width: 440rpx;
			border-radius: 10rpx;
		}
		.chakgd{
			padding: 20rpx 30rpx;
			background: #007AFF;
			border-radius: 10rpx;
			color: #ffffff;
		}
	}
	// 合同列表
	.htlist{
		width: 710rpx;
		padding: 20rpx;
		// margin-top: 120rpx;
		.hetxm{
			width: 650rpx;
			padding: 30rpx;
			background: #ffffff;
			border-radius: 20rpx;
			margin-bottom: 30rpx;
			.hetsbf{
				display: flex;
				align-items: center;
				justify-content: space-between;
				.htbiaoti{
					font-size: 35rpx;
					font-weight: bold;
				}
			}
			.hetxbf{
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-top: 20rpx;
				.hetjine{
					color: #3a4351;
					font-size: 26rpx;
				}
				.zifu{
					color: #007AFF;
				}
				.shok{
					color: #ff227a;
				}
			}
		}
	}
</style>
